package com.mysite.springcloud.demo.order.controller;

import com.mysite.springcloud.demo.api.vo.OrderVo;
import com.mysite.springcloud.demo.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @RequestMapping("/list")
    public List<OrderVo> getOrdersByUser(@RequestParam Long userId) {
        return orderService.getOrdersByUser(userId);
    }
}
